package com.example.hello;

import com.example.hello.client.NavWidget.BootstrapNavWidgetState;
import com.vaadin.ui.AbstractComponent;
import com.vaadin.ui.Component;

import java.util.LinkedList;
import java.util.List;

public class BootstrapNavWidget extends AbstractComponent {

    private List<Component> widgets = new LinkedList<Component>();

    public enum IconType {
        ASTERISK, BOOK
    }

    public enum IconPosition {
        LEFT, RIGHT
    }

    public enum IconSize {
        DEFAULT, LARGE, TWO_TIMES, THREE_TIMES, FOUR_TIMES, FIVE_TIMES
    }

    @Override
    public BootstrapNavWidgetState getState() {
        return (BootstrapNavWidgetState) super.getState();
    }

    public void add(Component widget) {
        widgets.add(widget);
    }

//    public void addWidget(Component widget) {
//        super.add(widget);
//    }

    public boolean isActive() {
        return getState().isActive();
    }

    public IconType getBaseIcon() {
        return IconType.valueOf(getState().getBaseIcon());
    }

    public String getCustomIconSet() {
        return getState().getCustomIconSet();
    }

    public boolean isDisabled() {
        return getState().isDisabled();
    }

    public String getHref() {
        return getState().getHref();
    }

    public IconType getIconType() {
        return IconType.valueOf(getState().getIcon());
    }

    public IconPosition getIconPosition() {
        return IconPosition.valueOf(getState().getIconPosition());
    }

    public IconSize getIconSize() {
        return IconSize.valueOf(getState().getIconSize());
    }

    public String getName() {
        return getState().getName();
    }

    public String getTarget() {
        return getState().getTarget();
    }

    public String getText() {
        return getState().getText();
    }

    public void setActive(boolean active) {
        getState().setActive(active);
    }

    public void setBaseIcon(IconType baseIcon) {
        getState().setBaseIcon(baseIcon.toString());
    }

    public void setCustomIconSet(String customIconSet) {
        getState().setCustomIconSet(customIconSet);
    }

    public void setDisabled(boolean disabled) {
        getState().setDisabled(disabled);
    }

    public void setHref(String href) {
        getState().setHref(href);
    }

    public void setIcon(IconType icon) {
        getState().setIcon(icon.toString());
    }

    public void setIconPosition(IconPosition iconPosition) {
        getState().setIconPosition(iconPosition.toString());
    }

    public void setIconSize(IconSize iconSize) {
        getState().setIconPosition(iconSize.toString());
    }

    public void setName(String name) {
        getState().setName(name);
    }

    public void setTarget(String target) {
        getState().setTarget(target);
    }

    public void setText(String text) {
        getState().setText(text);
    }

}